package com.wc.AlgoOJ_homework.AlgoOJ_BL3.K_异或和之差;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

/**
 * @Author congge
 * @Date 2024/4/4 10:52
 * @description http://43.138.190.70:8888/p/1098?tid=6602a77318e03a818a4bf04e
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 200010, M = 25;
    static int[] a = new int[N];
    static int[] s = new int[N];
    static int n;

    public static void main(String[] args) {
        n = sc.nextInt();
        for (int i = 1; i <= n; i++) {
            a[i] = sc.nextInt();
            s[i] = s[i - 1] ^ a[i];
        }
//        solve();
//        show(s,"sss");
        // map<key,value> 表示当前位置上是1的个数
        Map<Integer, ArrayList<Integer>> map = new HashMap<>();
        for (int i = 0; i <= 20; i++) {
            map.put(i, new ArrayList<>());
        }
        int[] minL = new int[N];
        int[] maxL = new int[N];
        int[] minR = new int[N];
        int[] maxR = new int[N];
        Arrays.fill(minL, (int) 1e7);
        Arrays.fill(minR, (int) 1e7);
        maxL[1] = minL[1] = a[1];
        minR[n] = maxR[n] = a[n];
        // 先把第一个装进去
        for (int i = 0; i <= 20; i++) {
            if ((s[1] >> i & 1) == 1) {
                map.get(i).add(1);
            }
        }
        // 前面找到1与这个位置1的个数
        for (int i = 2; i <= n; i++) {
            maxL[i] = minL[i] = s[i];
            boolean flg1 = false, flg2 = false;
            for (int j = 20; j >= 0; j--) {
                ArrayList<Integer> tmp = map.get(j);
                if (tmp.size() > 0) {
                    if ((s[i] >> j & 1) == 0 && !flg1) {
                        for (int id : tmp) {
                            maxL[i] = Math.max(maxL[i], s[i] ^ s[id]);
                        }
                        flg1 = true;
                    } else if (!flg2) {
                        for (int id : tmp) {
                            minL[i] = Math.min(minL[i], s[i] ^ s[id]);
                        }
                        flg2 = true;
                    }
                }
                if (flg1 && flg2) break;
            }
            for (int j = 0; j <= 20; j++) {
                if ((s[i] >> j & 1) == 1) {
                    map.get(j).add(i);
                }
            }
        }
        for (int i = 0; i <= 20; i++) {
            map.get(i).clear();
        }
        // 先把第n个装进去
        for (int i = 0; i <= 20; i++) {
            if ((s[n] >> i & 1) == 1) {
                map.get(i).add(n);
            }
        }

        for (int i = n - 1; i >= 1; i--) {
            maxR[i] = minR[i] = s[n] ^ s[i - 1];
            boolean flg1 = false, flg2 = false;
            for (int j = 20; j >= 0; j--) {
                ArrayList<Integer> tmp = map.get(j);
                if (tmp.size() > 0) {
                    if ((s[i] >> j & 1) == 0 && !flg1) {
                        for (int id : tmp) {
                            maxR[i] = Math.max(maxR[i], s[i - 1] ^ s[id]);
                        }
                        flg1 = true;
                    } else if (!flg2) {
                        for (int id : tmp) {
                            minR[i] = Math.min(minR[i], s[i - 1] ^ s[id]);
                        }
                        flg2 = true;
                    }
                }
                if (flg1 && flg2) break;
            }
            for (int j = 0; j <= 20; j++) {
                if ((s[i] >> j & 1) == 1) {
                    map.get(j).add(i);
                }
            }
        }
        // 缺了这一步
        for (int i = 1; i <= n; i++) {
            maxL[i] = Math.max(maxL[i - 1], maxL[i]);
            minL[i] = Math.min(minL[i], minL[i - 1]);
            maxR[n - i + 1] = Math.max(maxR[n - i + 1], maxR[n - i + 2]);
            minR[n - i + 1] = Math.min(minL[n - i + 1], minL[n - i + 2]);
        }
        int res = 0;
        for (int i = 1; i < n; i++) {
            res = Math.max(res, maxL[i] - minR[i + 1]);
            res = Math.max(res, maxR[i + 1] - minL[i]);
        }
//        show(maxL, "maxL");
//        show(minL, "minL");
//        show(maxR, "maxR");
//        show(minR, "minR");
        out.println(res);
        out.flush();
    }

    static void show(int[] a, String name) {
        out.print(name + ": ");
        for (int i = 1; i <= n; i++) out.print(a[i] + " ");
        out.println();
    }

    // 暴力
    static void solve() {
        int[] minL = new int[N];
        int[] maxL = new int[N];
        int[] minR = new int[N];
        int[] maxR = new int[N];
        Arrays.fill(minL, (int) 1e7);
        Arrays.fill(minR, (int) 1e7);
        for (int i = 1; i <= n; i++) {
            for (int j = 0; j < i; j++) {
                maxL[i] = Math.max(maxL[i], s[i] ^ s[j]);
                minL[i] = Math.min(minL[i], s[i] ^ s[j]);
                maxR[j + 1] = Math.max(maxR[j + 1], s[i] ^ s[j]);
                minR[j + 1] = Math.min(minR[j + 1], s[i] ^ s[j]);
            }
        }
        // 缺了这一步
        for (int i = 1; i <= n; i++) {
            maxL[i] = Math.max(maxL[i - 1], maxL[i]);
            minL[i] = Math.min(minL[i], minL[i - 1]);
            maxR[n - i + 1] = Math.max(maxR[n - i + 1], maxR[n - i + 2]);
            minR[n - i + 1] = Math.min(minL[n - i + 1], minL[n - i + 2]);
        }
        int res = 0;
        for (int i = 1; i < n; i++) {
            res = Math.max(res, maxL[i] - minR[i + 1]);
            res = Math.max(res, maxR[i + 1] - minL[i]);
        }
        show(maxL, "maxL");
        show(minL, "minL");
        show(maxR, "maxR");
        show(minR, "minR");
        out.println(res);
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
